{include file="public/header"}
	<style>
		.addAddr {display: inline-block !important;width: 42vw !important;margin: 0 2vw !important;}
		.cancel{background-color: gainsboro !important;}
		.addNewAddr{text-align: center !important;}
	</style>
</head>
<body>
	<header>
		<div>
			<a href="javascript:history.back();"><i class="icon-fanhui icon iconfont"></i></a>
		</div>
		<div>
			我的订单
		</div>
		<div></div>
	</header>
	<div class="main vip">
		
		<div class="tabs">
			<a href="user.html" class="active">我的订单</a>
			<a href="../address/address.html">收货地址</a>
		</div>
		
		<div class="tabContent">
			<div class="orderDetail">
				<div class="orderId">
					<span class="oid">
						订单号：{$find['order_sn']}
					</span>
					<span class="pstate">
						状态：<a href="#">{$find['order_status']}</a>
					</span>
				</div>
				<div class="take">
					<h1>收货人</h1>
					<span class="uinfo">
						<span class="name">{$find['aname']}</span>
						<span class="pnumber">{$find['atel']}</span>
					</span>
					<span class="adr">
						{$find['sheng']} {$find['city']} {$find['quyu']}
					</span>
				</div>
				<div class="pay">
					<h1>支付信息</h1>
					<span class="tprice">
						总金额：<span>￥{$find['price']}</span>
					</span>
					<span class="pprice">
						商品金额：<span>￥<s>{$find['amount']}</s></span>
					</span>
					<span class="sprice">
						下单时间：<span>{:date('Y-m-d H:i:d',$find['addtime'])}</span>
					</span>
				</div>
				<div class="goods">
					<h1>商品清单</h1>
					{foreach $porduct as $v}
					<div class="item">
						<div class="img">
							<img src="/static/{$v['photo_x']}" alt="">
						</div>
						<div class="ginfo">
							<span class="gname">
								{$v['name']}
							</span>
							<span class="gprice">
								￥{$v['price']} X {$v['num']} = {$v['price']*$v['num']}
							</span>
						</div>
					</div>
					{/foreach}
				</div>
			</div>
			<div class="addNewAddr" sid="{$find['id']}">
				{if $find['status']==10}
				<a href="{:url('Good/buy',['sn'=>$find['order_sn']])}" class="addAddr">去支付</a>
				<a href="#" class="addAddr cancel"  id="close">取消订单</a>
				{elseif $find['status']==11/}
				<a href="{:url('User/backMoney',['sn'=>$find['order_sn']])}" class="addAddr">申请退款</a>
				{elseif $find['status']==12/}
				<a href="{:url('User/backMoney',['sn'=>$find['order_sn']])}" class="addAddr">申请退款</a>
				<a href="#" class="addAddr" id="yes">确认收货</a>
				{/if}
			</div>
		</div>
		<script>
			$('#close').click(function () {
                var sid = $(this).parent().attr('sid');
                $.ajax({
                    type: 'post',
                    url: '{:url("User/ajaxquxiao")}',
                    data: {sid:sid},
                    dataType: 'json',
                    success: function (data) {
                        if (data){
                            alert('取消成功');
                            location.href='user';
                        }else{
                            alert('网络波动');
                        }
                    }
                });
            })
            $('#yes').click(function () {
                var sid = $(this).parent().attr('sid');
                $.ajax({
                    type: 'post',
                    url: '{:url("User/ajaxyes")}',
                    data: {sid:sid},
                    dataType: 'json',
                    success: function (data) {
                        if (data){
                            alert('确认成功');
                            location.href='user';
                        }else{
                            alert('网络波动');
                        }
                    }
                });
            })
		</script>
	</div>
	{include file="public/footer"}
</body>
</html>